<?php
require_once '../inc/configuration.php';
require_once '../inc/connexion_db.php';



$id = isset($_GET['id']) ? $_GET['id'] : "";
$message_action = isset($_GET["message_action"]) ? unserialize($_GET["message_action"]) : "";

if(!empty($id)) {
    $where = "WHERE id_entreprise=".$id;
}
else {
    $where = "";
}
$order = isset($_GET['ordre']) ? "ORDER BY nom ".$_GET['ordre']." , prenom ".$_GET['ordre'] : "";

//REQUETE SQL
$sql = "SELECT *, entreprises.raison_sociale FROM contacts, entreprises WHERE  contacts.id=".$id." AND contacts.id_entreprise=entreprises.id";
$req = mysqli_query($connexion_bd, $sql);

$nbre_total = mysqli_num_rows($req);


$data = mysqli_fetch_array($req);

require('fpdf.php');

$pdf = new FPDF();
$pdf->AddPage();
$pdf->SetFillColor(245,245,220);
$pdf->Rect(1,1,85,54,"D"); 
$pdf->SetFillColor(176,196,222);
$pdf->Rect(1.3,34.8,84.5,20,"F");
$pdf->SetFillColor(119,136,153);
$pdf->Rect(1.3,33,84.5,2,"F");
$pdf->Image("../fdpf/".$data["photo"],3,2,30);
$pdf->SetFont('Arial','B',16);
$pdf->Text(40,10,$data["raison_sociale"]);
$pdf->SetFont('Arial','',12);
$pdf->Text(40,18,'3 Bis avenue de la rue');
$pdf->Text(40,25,'75000 PARIS');
$pdf->Text(5,40,'Commercial');
$pdf->Text(5,46,$data["nom"]." ".$data["prenom"]);
$pdf->SetFont('Arial','',8);
$pdf->Text(5,51,$data["email"]);
$pdf->SetFont('Arial','',12);
$pdf->Text(55,40,$data["telephone"]);
$pdf->Output();


?>